#include "printk.h"
#include "stdio.h"
#include "types.h"

/**
 * This function will print the information of kernel
 *
 * @param fmt the string should be printed
 *
 * @return the number of printed character
 */
int printk(const char *fmt, ...)
{
    va_list args;
    int bytes;
    char printk_buf[256];
    extern int fputc(int ch, FILE *stream);

    va_start(args, fmt);
    bytes = vsprintf(printk_buf, fmt, args);
    va_end(args);

    for(int i = 0; i < bytes; i++)
    {
        fputc(printk_buf[i], NULL);
    }

    return bytes;
}
